<?php
/**
 * This file is a subject under proprietary sofrware license
 * 
 * @category
 * @package
 * @subpackage
 * @author      valerii lazarevych <lazarevuch@gmail.com>
 * @copyright   Copyright(c) Valerii Lazarevych
 * @license     proprietary software license
 * @version     $Id: AjaxController.php 29.09.2012 20:46:48 valerii $
 */

/**
 * Class AjaxController
 * 
 * Application container for all ajax functions.
 */
class AjaxController extends Zend_Controller_Action
{
    /**
     * Initialize method
     * Do things
     * 1. Turn off Zend layout rendering
     */
    public function init()
    {
        if ($this->getRequest()->isXmlHttpRequest()){            
            $this->_helper->layout->disableLayout();    }
    }
        
    /**
     * Adding news 
     */
    public function addnewsAction()
    {
        $newModel   =   new models_News;
        $news       =   new domainObjects_News();
                        
        $news->build( $this->_getAllParams() );        
        $news->save();
        
        echo    Zend_Json::encode( $newModel->newsList());        
    }
        
}
